#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>


void* function_A(void *arg){
	printf("Hello!My Name is functionA ,My ID is %d\n", *(int*)arg );
	return arg;
}

void* function_B(void *arg){
    printf("Thread!My Name is functionB ,My ID is %d\n", *(int*)arg );
	return arg;
}


void main(){
	pthread_t pth1,pth2;
	int res = 0;
	int arg1 = 15;
	int arg2 = 50;
    int *thread_ret = NULL;  

	printf("This is Main Thread\n");
	res = pthread_create(&pth1 ,NULL , function_A , &arg1);
	if(res != 0 )
		printf("pthreadA create failed\n");

	res = pthread_create(&pth2 ,NULL , function_B , &arg2);
    if(res != 0 )
        printf("pthreadA create failed\n");
    
	pthread_join(pth1,(void**)&thread_ret );  
    printf( "threadA_ret = %d.\n", *thread_ret );

	pthread_join(pth2,(void**)&thread_ret );
    printf( "threadB_ret = %d.\n", *thread_ret );
}

